Subdirectories within an album

Last post 11-21-2007, 4:20 PM by bendo. 1 replies.
Sort Posts: Previous Next
  •  11-20-2007, 4:48 PM 35254

    Subdirectories within an album

    Can I have the subdirectories listed automatically along with the thumbnails of an album? Looks like it would be fairly easy to add in a component to look for subdirs and add them in to the datagrid (as an image of a folder or something) with links to the corrosponding show.aspx?album=album/subdir" required to browse it. I suppose I could put this in myself but I do not want to pay for something that I have to put coding time in to.
     
    Thanks,
    Ben Dixon
  •  11-21-2007, 4:20 PM 35286 in reply to 35254

    Re: Subdirectories within an album

    OK, to accomplish this I replaced show.aspx with this. Don't forget to change actualdirectoryString to the correct directory.
     

    <%@ Page Language="VB"%>

    <%@ Import Namespace="System" %>

    <%@ Import Namespace="System.IO" %>

    <%@ Register TagPrefix="CE" Namespace="DotNetGallery" Assembly="DotNetGallery" %>

    <html>

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

    <title>DotNetGallery Album Demonstration</title>

    <link rel="stylesheet" href="example.css" type="text/css" />

    <script runat="server">

    Private album As String

    Private x,y As Integer

    Dim curdir As String

    Dim rootdir As String

    Dim rootdirlink As String

    Dim subdir As String() = New String(199){}

    Dim subdirtag As String() = New String(199){}

    Dim subdirectory As String() = New String(199){}

    ' Obtain the gallery folder from query string

    Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

    album = Request.QueryString("album")

    If album Is Nothing OrElse album = "/" Then

    gallery1.FolderPath = "album1"

    End If

    gallery1.FolderPath = album

     

    'Get a list of SubDirectories

     

    Dim actualdirectoryString As String = "C:/inetpub/wwwroot/dotnetgallery/" + gallery1.FolderPath

    HttpContext.Current.Response.Write(" actual: " + actualdirectoryString)

    Dim directories As String() = Directory.GetDirectories(actualdirectoryString)

    Dim ib As Integer = gallery1.folderpath.LastIndexOf("\"C)

    curdir = gallery1.folderpath.Substring(ib+1)

    if ib > 0 then

    rootdir = gallery1.folderpath.Remove(ib)

    rootdirlink = "show.aspx?album="+rootdir

    else

    rootdir = ""

    rootdirlink = "#"

    end if

    'HttpContext.Current.Response.Write(" gallery1 " + gallery1.folderpath)

    'HttpContext.Current.Response.Write(" curdir " + curdir)

    'HttpContext.Current.Response.Write(" rootdirectory " + rootdir)

    'HttpContext.Current.Response.Write(" rootdirlink " + rootdirlink)

    x = 0

    For Each directory As String In directories

    Dim i As Integer = directory.LastIndexOf("/"C)

    Dim ia As Integer = directory.LastIndexOf("\"C)

    subdir(x) = directory.Substring(i + 1)

    subdirtag(x) = directory.Substring(ia + 1)

    subdirectory(x) = "show.aspx?album="+subdir(x)

    'HttpContext.Current.Response.Write(" subdirectory " + subdirectory(x))

    'HttpContext.Current.Response.Write(" subdir " + subdir(x))

    'HttpContext.Current.Response.Write(" subdirtag " + subdirtag(x))

     

    x = x + 1

    Next

     

    End Sub

     

    </script>

    </head>

    <body bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0 marginwidth="0" marginheight="0">

    <form runat="server" ID="mainform">

    <table class=HeadBg id=Table3 cellSpacing=0 cellPadding=0 width="100%" align=center border=0>

    <tr>

    <td vAlign=center width=250 height=60 nowrap valign="middle">&nbsp;

    <a href="default.htm"><IMG alt=CuteEditor src="sampleimage/logo.gif" border=0></a>

    </td>

    <td align=center valign="bottom" width=100%></td>

    <td class=normal vAlign=center align=center nowrap width=200 height=16>

    </td>

    </tr>

    </table>

     

    <div id="LocalToolbar">

    <table height="21" cellSpacing="0" cellPadding="0" width="100%" border="0" ID="Table1">

    <tr>

    <td noWrap>&nbsp;&nbsp;

    <a class="SectionMenu" href="default.htm">Home</a><span class="Accent">|</span>

    <a class="SectionMenu" href="demo.aspx">Demo 1 </a><span class="Accent">|</span>

    <a class="SectionMenu" href="demo2.aspx">Demo 2 </a><span class="Accent">|</span>

    <a class="SectionMenu" href="Album.htm">Album </a><span class="Accent">|</span>

    <a class="SectionMenu" href="Deployment.htm">Deployment</a><span class="Accent">|</span>

    <a class="SectionMenu" href="http://cutesoft.net/Forums/">Forums</a><span class="Accent">|</span>

    <a class="SectionMenu" href="http://cutesoft.net/ASP.NET+Image+Gallery/Purchase+ASP.NET+Image+Gallery/default.aspx">Order</a>

    </td>

    <td width="100%"></td>

    </tr>

    </table>

    </div>

     

    <h1 align="center">DotNetGallery Album Demonstration</h1>

    <p align="left">

    <h3 align="left"><a href="

    <%=rootdirlink%>

    ">

    <%=rootdir%>

    </a>\

    <%=curdir%>

    \ +

    <%

    for y = 0 to x-1

    %>

    <br /> + +

    <a href = "

    <%=subdirectory(y)%>

    ">

    <%=subdirtag(y)%>

    </a>

    <%next y%>

     

    </h3>

     

    </p>

    <p align=center>

    <CE:Gallery

    id="gallery1"

    runat="server"

    Width="600"

    Column = "8"

    MaxImageWidth="1024"

    BackColor="#ffffff"

    CellPadding="5"

    AutoResizeUploadedImages = "true"

    CellSpacing="5"

    ForeColor="#000000"

    BorderColor="#cc0000"

    BorderStyle="solid"

    BorderWidth="0"

    CssClass="container"

    ShowThumbNailName="true"

    ShowThumbNailSize="false"

    ShowThumbNailDate="false"

    ShowThumbNailDescription="true"

    HomeURL="album.htm"

    ></CE:Gallery><br>

    </p>

     

    <div id="footer">

    <p><a href="http://cutesoft.net">Copyright 2005 CuteSoft.Net. All rights reserved.</a></p>

    </div>

    </form>

    </body>

    </html>
     
     
     
    Ben Dixon
View as RSS news feed in XML